<template>
	<view>
		<u-card>
			<view class="" slot="head">
				<view class="wrap">
					<u-row>
						<u-col span="4" text-align="center">
							<view class=" weikaishi">
								<span>领取时间</span>
							</view>
						</u-col>
						<u-col span="4" text-align="center">
							<view class=" weikaishi">
								<span>领取人</span>
							</view>
						</u-col>
						<u-col span="4" text-align="center">
							<view class=" weikaishi">
								<span>目的地</span>
							</view>
						</u-col>
					</u-row>
				</view>
			</view>
			<view class="" slot="body">
				<u-row v-for="(item,index) in dataList" :key="index" @click="toput(item.id,item.transportUser)">
					<u-col span="4" text-align="center">
						<view class="lanse u-m-t-10 huanhang">
							<span>{{item.acceptOrdersTime}}</span>
						</view>
					</u-col>
					<u-col span="4" text-align="center">
						<view class="u-m-t-10 huanhang">
							<span>{{item.transportUserName}}</span>
						</view>
					</u-col>
					<u-col span="4" text-align="center">
						<view class="u-m-t-10 huanhang">
							<span>{{item.tarPositionCode}}</span>
						</view>
					</u-col>
				</u-row>
			</view>
		</u-card>
		<view style="height: 90rpx;">
		</view>
		<view class="wrap"
			style="position: fixed;bottom: 0rpx;width: 100%;background-color: #2979ff;z-index: 999;height: 80rpx;">
			<u-line color="#bababa" />
			<u-row>
				<u-col span="12" text-align="center" @click="submit()">
					<view class="u-line-1 u-m-t-10 baise">
						提交
					</view>
				</u-col>
			</u-row>
		</view>
		<view>
			<u-toast ref="uToast" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				flex: '',
				keyword: '',
				did: '',
				arealist: [],
				current: 0,
				dataList: [],
			}
		},
		onLoad(open) {
			//#ifdef H5 || APP-PLUS
			this.flex = 'u-flex'
			//#endif
		
			this.did = open.id
			this.refresh()
		},
		onShow() {
			this.refresh()
		},
		onPullDownRefresh() {
			this.refresh()
			uni.stopPullDownRefresh()
		},
		methods: {
			refresh() {
					this.$http.post('/rest/xhTransportController/queryAllItem', {}, {
						params: {
							condition: this.keyword
						},
						header: {
							'Authorization': uni.getStorageSync('token'),
						}
					}).then(res => {
						this.dataList = res.data.data
					})
			},
			submit() {
				uni.showModal({
					title: '确定提交吗？',
					success: (res) => {
						if (res.confirm) {
							uni.showLoading({
								title: '加载中...'
							})
							this.$http.post('/rest/xhTransportController/reviewCompleted', {}, {
								params: {
									id: this.did,
								},
								header: {
									'Authorization': uni.getStorageSync('token'),
								}
							}).then(res => {
								uni.hideLoading()
								if (res.data.code == 200) {
									this.$refs.uToast.show({
										title: '提交成功',
										type: 'success'
									})
									setTimeout(() => {
										this.$Router.back()
									}, 1000)
									this.$Router.push({
										name: 'xh_goods_transport',
										params: { id:item.id},
									})
								} else {
									this.$refs.uToast.show({
										title: res.data.message,
										type: 'error'
									})
									setTimeout(() => {
										this.refresh()
									}, 1000)
								}
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			},
			sectionChange(e) {
				this.current = e
				uni.showLoading({
					title: '加载中'
				})
				this.refresh()
				setTimeout(() => {
					uni.hideLoading()
				}, 500)
			},
			search(e) {
				uni.showLoading({
					title: '加载中'
				})
				this.refresh()
				setTimeout(() => {
					uni.hideLoading()
				}, 500)
			},
			radioChange(e) {
				console.log(e);
			},
		}
	}
</script>


<style lang="scss">
	.u-body-item {
		padding: 20rpx 15rpx;
	}

	.wrap {
		padding: 0rpx 12rpx;
	}

	.u-row {
		margin: 10rpx 2rpx;
	}

	.weikaishi2 {
		font-size: 34rpx;
	}

	.weikaishi3 {
		font-size: 30rpx;
	}

	.jiange {
		border-bottom: 1px solid #ebebeb;
	}

	.huanhang {
		word-break: break-all;
	}

	.baise {
		background-color: #2979ff;
		color: #ffffff;
		font-size: 45rpx;
	}
</style>
